package com.bupt.uchouten.common.item;

import com.bupt.uchouten.common.skill.Earthquake;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.*;
import net.minecraft.world.level.Level;

public class SwordOfScarletItem extends SwordItem {
    public SwordOfScarletItem() {
        // Damage will += 5
        // Attack speed is 4 - 2.6 = 1.4
        super(Tiers.NETHERITE, 5, -2.6f, new Item.Properties().stacksTo(1));
    }

    @Override
    public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
        ItemStack sword = player.getItemInHand(hand);
        if (hand != InteractionHand.MAIN_HAND) {
            return InteractionResultHolder.pass(sword);
        }
        player.getCooldowns().addCooldown(this, 50);
        player.startUsingItem(hand);

        Earthquake.getInstance().cast(level, player);
        return InteractionResultHolder.consume(sword);
    }
}
